<?php
/**
 * Created by PhpStorm.
 * User: liyu
 * Date: 2018/4/16
 * Time: 下午5:02
 */

namespace app\common\command;


use think\Cache;
use think\console\Command;
use think\console\Input;
use think\console\Output;

class liyu extends Command
{
    protected $sleep = 3;
    protected function configure()
    {
        $this->setName('liyu')->setDescription('Here is the liyu\'s command ');
    }

    protected function execute(Input $input, Output $output)
    {
        while(true){
            $output->writeln(json_encode($this->checkDo()));
            sleep($this->sleep);
        }


    }

    protected function checkDo(){
        $state = false;
        $int = Cache::inc("Command",1);

        //这里根据查询的缓存内容 或者时间 写你的逻辑代码
        //----------------
        //   you code
        //--------------

        return $int;
    }
}